{extend name="common/base" /} {block name="titlekeyword"}
<title>{$content}</title>

{/block} {block name="headjs"}
<script language="javascript">
	var num1 = window.prompt("请输入第一个数");
	var num2 = window.prompt("请输入第二个数");
	var operator = window.prompt("请输入运算符");
	num1 = parseFloat(num1);
	num2 = parseFloat(num2);

	document.write("res=" + JiSuan(num1, num2, operator));
    /**
      * 计算的函数 可以被调用 
	  * 返回 res 
     */
	function JiSuan(num1, num2, operator) {
		var res = 0;
		if (operator == "+") {
			alert(num1);
			alert(num2);
			res = num1 + num2;
			alert("+" + res);
		}

		else if (operator == "-") {
			res = num1 - num2;

		}

		return res;
	}


</script> {/block} {block name="main"}
<h1> 预置内容</h1>
<pre>
&lt;script language="javascript"&gt;
 var num1=window.prompt("请输入第一个数");
var num2=window.prompt("请输入第二个数");
var operator=window.prompt("请输入运算符");
num1=parseFloat(num1);
num2=parseFloat(num2);

 document.write("res="+JiSuan(num1,num2,operator));  //调用函数

    /**
      * 计算的函数 可以被调用 
	  * 返回 res 
     */
 function JiSuan(num1,num2,operator){

var res=0;
    if(operator=="+"){
	alert (num1);
	alert (num2);
	res=num1+num2;
	alert ("+"+res);
     }

else if(operator=="-"){
	res=num1-num2;
	
}

return res;
}

 
&lt;/script&gt;
</pre> {/block}